package ae.pcfc.etks.online.itworx.ehs.web.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.web.multipart.MultipartFile;

import ae.pcfc.etks.online.itworx.ehs.web.entity.Comment;
import ae.pcfc.etks.online.itworx.ehs.web.entity.DocumentType;
import ae.pcfc.etks.online.itworx.ehs.web.entity.FNPDetails;
import ae.pcfc.etks.online.itworx.ehs.web.entity.OFCDocument;
import ae.pcfc.etks.online.itworx.ehs.web.entity.OFCRequestHistory;
import ae.pcfc.etks.online.itworx.ehs.web.enums.AmendmentType;
import ae.pcfc.etks.online.itworx.ehs.web.enums.RequestStatus;
import ae.pcfc.etks.online.itworx.ehs.web.enums.RequestType;
import ae.pcfc.etks.online.itworx.ehs.web.util.UtilCommon;

public class OFCRequestCreation implements Serializable{

	private long id;
	private String companyNameArabic;
	private String companyNameEnglish;
	@Length(max = 50)
	private String licenseNumber;
	@Length(max = 50)
	@Email
	private String mainEmail;
	@Length(min = 1, max = 50)
	private String businessUnit;
	@Length(max = 4000)
	private String engActivity;
	@Length(max = 4000)
	private String arActivity;
	private Date creationDate;
	@NotEmpty
	@Length(min = 1, max = 50)
	private String location;
	@Length(max = 500)
	private String remarks;
	@Length(max = 50)
	private String requestedBy;
	@Length(max = 30)
	private String bcc;
	@Length(min = 1, max = 50)
	@NotEmpty
	private String contactPersonName;
	@NotEmpty
	@Length(min = 1, max = 30)
	private String telephone;
	@Length(max = 30)
	private String fax;
	@Length(max = 30)
	private String mobile;
	@NotEmpty
	@Email
	private String alternativeEmail;
	@Email
	private String optionalMail;
	private long documentTypeId;
	private List<DocumentType> documentTypes;
	private MultipartFile multipartFile;
	private List<MultipartFile> multipartFiles;
	private List<OFCDocument> documents;
	@Length(max = 10)
	private String imsLogId;
	private RequestType type;
	private String amendmentStyle;
	private String renewalStyle;
	private AmendmentType[] amendmentTypes;
	private String amendmentType;
	private String userId;
	private RequestStatus status;
	private List<OFCRequestHistory> ofcHistory;
	private String fnpDetails;
	private String processId;
	@Length(max = 500)
    private String officerComments;
    private List<FNPDetails> fnpList;
    private List<Comment> comments;
    private String officerId;
    private String trakheesId;
    private String serviceName;
    private List<String> locations;
    private String documentTypesJSON;

    public String getDocumentTypesJSON() {
		return documentTypesJSON;
	}

	public void setDocumentTypesJSON(String documentTypesJSON) {
		this.documentTypesJSON = documentTypesJSON;
	}

	public List<String> getLocations() {
		return locations;
	}

	public void setLocations(List<String> locations) {
		this.locations = locations;
	}

	public String getServiceName() {
		return serviceName;
	}

	public void setServiceName(String serviceName) {
		this.serviceName = serviceName;
	}

	public String getArActivity() {
		return arActivity;
	}

	public void setArActivity(String arActivity) {
		this.arActivity = arActivity;
	}
	
	public String getTrakheesId() {
		return trakheesId;
	}

	public void setTrakheesId(String trakheesId) {
		this.trakheesId = trakheesId;
	}

	public String getOfficerId() {
		return officerId;
	}

	public void setOfficerId(String officerId) {
		this.officerId = officerId;
	}

	public List<Comment> getComments() {
		return comments;
	}

	public void setComments(List<Comment> comments) {
		this.comments = comments;
	}

	public List<FNPDetails> getFnpList() {
		return fnpList;
	}

	public void setFnpList(List<FNPDetails> fnpList) {
		this.fnpList = fnpList;
	}

	public String getOfficerComments() {
		return officerComments;
	}

	public void setOfficerComments(String officerComments) {
		this.officerComments = officerComments;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}
	
	public List<OFCRequestHistory> getOfcHistory() {
		return ofcHistory;
	}

	public void setOfcHistory(List<OFCRequestHistory> ofcHistory) {
		this.ofcHistory = ofcHistory;
	}

	public RequestStatus getStatus() {
		return status;
	}

	public void setStatus(RequestStatus status) {
		this.status = status;
	}

	public String getOptionalMail() {
		return optionalMail;
	}

	public void setOptionalMail(String optionalMail) {
		this.optionalMail = optionalMail;
	}
	
	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getAmendmentType() {
		return amendmentType;
	}

	public void setAmendmentType(String amendmentType) {
		this.amendmentType = amendmentType;
	}

	public AmendmentType[] getAmendmentTypes() {
		return amendmentTypes;
	}

	public void setAmendmentTypes(AmendmentType[] amendmentTypes) {
		this.amendmentTypes = amendmentTypes;
	}

	public String getAmendmentStyle() {
		return amendmentStyle;
	}

	public void setAmendmentStyle(String amendmentStyle) {
		this.amendmentStyle = amendmentStyle;
	}

	public String getRenewalStyle() {
		return renewalStyle;
	}

	public void setRenewalStyle(String renewalStyle) {
		this.renewalStyle = renewalStyle;
	}

	public RequestType getType() {
		return type;
	}

	public void setType(RequestType type) {
		this.type = type;
	}

	public String getImsLogId() {
		return imsLogId;
	}

	public void setImsLogId(String imsLogId) {
		this.imsLogId = imsLogId;
	}

	public String getCompanyNameArabic() {
		return companyNameArabic;
	}

	public void setCompanyNameArabic(String companyNameArabic) {
		this.companyNameArabic = companyNameArabic;
	}

	public String getCompanyNameEnglish() {
		return companyNameEnglish;
	}

	public void setCompanyNameEnglish(String companyNameEnglish) {
		this.companyNameEnglish = companyNameEnglish;
	}

	public String getLicenseNumber() {
		return licenseNumber;
	}

	public void setLicenseNumber(String licenseNumber) {
		this.licenseNumber = licenseNumber;
	}

	public String getMainEmail() {
		return mainEmail;
	}

	public void setMainEmail(String mainEmail) {
		this.mainEmail = mainEmail;
	}

	public String getBusinessUnit() {
		return businessUnit;
	}

	public void setBusinessUnit(String businessUnit) {
		this.businessUnit = businessUnit;
	}

	public String getEngActivity() {
		return engActivity;
	}

	public void setEngActivity(String engActivity) {
		this.engActivity = engActivity;
	}

	public Date getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	public String getLocation() {
		return location;
	}

	public void setLocation(String location) {
		this.location = location;
	}

	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	public String getRequestedBy() {
		return requestedBy;
	}

	public void setRequestedBy(String requestedBy) {
		this.requestedBy = requestedBy;
	}

	public String getBcc() {
		return bcc;
	}

	public void setBcc(String bcc) {
		this.bcc = bcc;
	}

	public long getDocumentTypeId() {
		return documentTypeId;
	}

	public void setDocumentTypeId(long documentTypeId) {
		this.documentTypeId = documentTypeId;
	}

	public List<DocumentType> getDocumentTypes() {
		return documentTypes;
	}

	public void setDocumentTypes(List<DocumentType> documentTypes) {
		this.documentTypes = documentTypes;
	}

	public MultipartFile getMultipartFile() {
		return multipartFile;
	}

	public void setMultipartFile(MultipartFile multipartFile) {
		this.multipartFile = multipartFile;
	}

	public List<MultipartFile> getMultipartFiles() {
		return multipartFiles;
	}

	public void setMultipartFiles(List<MultipartFile> multipartFiles) {
		this.multipartFiles = multipartFiles;
	}

	public List<OFCDocument> getDocuments() {
		return documents;
	}

	public void setDocuments(List<OFCDocument> documents) {
		this.documents = documents;
	}

	public String getContactPersonName() {
		return contactPersonName;
	}

	public void setContactPersonName(String contactPersonName) {
		this.contactPersonName = contactPersonName;
	}

	public String getTelephone() {
		return telephone;
	}

	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}

	public String getFax() {
		return fax;
	}

	public void setFax(String fax) {
		this.fax = fax;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public String getAlternativeEmail() {
		return alternativeEmail;
	}

	public void setAlternativeEmail(String alternativeEmail) {
		this.alternativeEmail = alternativeEmail;
	}

	public String getFnpDetails() {
		return fnpDetails;
	}

	public void setFnpDetails(String fnpDetails) {
		this.fnpDetails = fnpDetails;
	}

	public String getProcessId() {
		return processId;
	}

	public void setProcessId(String processId) {
		this.processId = processId;
	}
	
	public AmendmentType[] getAmendmentTypesAsArray(){
		if(amendmentType == null) return null;
		String[] types = amendmentType.split(",");
		List<AmendmentType> typesList = new ArrayList<AmendmentType>();
		for(String type: types){
			if(!UtilCommon.isEmpty(type)){
				typesList.add(AmendmentType.getFromPropertyName(type));
			}
		}
		return typesList.toArray(new AmendmentType[typesList.size()]);
	}
	
}
